home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
amigadoslibrary
/
fgetc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
918b
|
47 lines
/* FGetC.c V1.1 93-03-03 */
/* ROM library: "dos.library/FGetC", (V36+) */
/* Copyright 1993, Anders Bjerin, Amiga C Club */
#include <dos/dos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
UBYTE *version = "$VER: FGetC 1.1";
int main( int argc, char *argv[] );
int main( int argc, char *argv[] )
{
BPTR my_file;
LONG collected;
/* Open an already existing file: */
my_file = Open( "RAM:Important.dat", MODE_OLDFILE );
if( !my_file )
exit( 20 );
/* Read one character: */
collected = FGetC( my_file );
/* OK? */
if( collected == -1 )
{
/* Could not collect the character! */
/* Check if it was EOF or an Error: */
if( IoErr() )
printf( "There was an error!\n" );
else
printf( "End of file (EOF)!\n" );
}
else
printf( "The character was \"%c\"!\n", collected );
Close( my_file );
exit( 0 );
}